﻿/*----------------------------------------------------------------
 * 
 * 版权所有：Copyright (C) 2013
 * 
 * 文件名：ArticlePartitionConfiguration.cs
 * 文件功能描述：
 * 
 * 
 * 作 者：zhangq
 * 邮 箱：ifunnyface@outlook.com
 * 日 期：2013-01-07 01:47:50
 * 
 * 
 * 修改标识： Author
 * 修改描述： 相关描述
 * 
 * ---------------------------------------------------------------- */

using DomainModel;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;

namespace Infrastructure.Mapper
{

    /// <summary>
    /// 文章分类信息数据映射
    /// </summary>
    public class ArticlePartitionConfiguration : EntityTypeConfiguration<ArticlePartitionInfo>
    {

        /// <summary>
        /// 映射数据库表/字段
        /// </summary>
        public ArticlePartitionConfiguration()
        {
            ToTable("CTB_ArticlePartitions");
            HasKey(u => u.PartitionId);
            Property(u => u.PartitionId).HasMaxLength(20);
            Property(u => u.ParentId).HasMaxLength(20);
            Property(u => u.Description).HasMaxLength(200);
            Property(u => u.Name).HasMaxLength(50);
            Property(u => u.SortNumber);
            Property(u => u.Enabled);
            Property(u => u.Level);
            Property(u => u.HasChildren);

            HasRequired(t => t.ArticlePartition)
                .WithMany(t => t.Children)
                .HasForeignKey(d => d.ParentId);


        }

         
    }

}